int main(int argc, char **argv) {

  int myrank, tag=99;
  int vector[3];
  MPI_Status status;
  int i1, i2;
  MPI_Comm GridComm;
  MPI_Init( NULL, NULL );
  MPI_Comm_rank( MPI_COMM_WORLD, &myrank );
  int dims[2] = {3,4};
  int period[2] = {0,1};
  int coords[2];
  MPI_Cart_create(MPI_COMM_WORLD,2,dims,period,1,&GridComm);
  int gridrank;
  MPI_Comm_rank(GridComm,&gridrank);
  MPI_Cart_coords(GridComm,gridrank,2,coords);
  MPI_Comm SubComm;
  int remain[2] = {1,0};
  MPI_Cart_sub(GridComm,remain,&SubComm);
  int subRank;
  MPI_Comm_rank(SubComm,&subRank);
  int subcoord;
  MPI_Cart_coords(SubComm,subRank,1,&subcoord);



  if (coords[0] == 1)
    {
      vector[0] = gridrank;
      vector[1] = gridrank;
      vector[2] = gridrank;
    }
 int sendRank;
  int a =1;
  MPI_Cart_rank(SubComm,&a,&sendRank);
  int recvbuf;
  MPI_Scatter(vector,3,MPI_INT,&recvbuf,1,MPI_INT,sendRank,SubComm);

  printf("je suis %d dans grid de coord[%d,%d], je contiens %d\n",gridrank,coords[0],coords[1],recvbuf);

  MPI_Finalize();
  return 0;
}
